//
//  YHYAFNetTool.h
//  Travels
//
//  Created by yanghuiyan on 16/3/7.
//  Copyright © 2016年 yanghuiyan. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^BlockOfSuccess)(id result);
typedef NS_ENUM(NSUInteger, YHYResponseStyle) {
    YHYJSON,
    YHYXML,
    YHYDATA
};
typedef NS_ENUM(NSUInteger, YHYRequestStyle) {
    YHYRequestJSON,
    YHYRequestString,
};

@interface YHYAFNetTool : NSObject

#pragma mark - GET请求
+ (void)GETNetWirhUrl:(NSString *)url
                 body:(id)body
           headerFile:(NSDictionary *)header
             response:(YHYResponseStyle)responseStyle
              Success:(BlockOfSuccess)success
              Failure:(void (^)(NSError * error))failure;


#pragma mark - POST请求
+ (void)POSTNetWirhUrl:(NSString *)url
                  body:(id)body
             bodyStyle:(YHYRequestStyle)bodyRequestStyle
            headerFile:(NSDictionary *)header
              response:(YHYResponseStyle)responseStyle
               Success:(BlockOfSuccess)success
               Failure:(void (^)(NSError * error))failure;



#pragma mark - 本地储存
//从本地请求数据
+ (NSString *)createFilePathFromDocumentWithFolders:(NSArray<NSString *> *)folders fileName:(NSString *)fileName;
//保存从本地请求下来的数据
+ (BOOL)saveDataOnLocal:(NSData *)data localPath:(NSString *)path;

@end
